Add namespaced resources #128#141
Conversation
- Update crossplane-runtime from v1.20.0 to v2.0.0 - Implement missing interface methods for crossplane-runtime v2 compatibility: - Add GetUsers/SetUsers for UserCounter interface on ProviderConfig - Add GetItems for ProviderConfigUsageList interface - Add SetResourceReference/GetResourceReference for ProviderConfigUsage - Add compile-time interface validation with var _ assignments - Fix JQ expression syntax in e2e test examples: - Remove problematic outer parentheses from URL expressions - Fix Authorization header secret injection syntax - Add interface casting tests to prevent runtime panics - Update go.mod and go.sum for crossplane-runtime v2 dependencies - Use chainsaw for e2e tests Signed-off-by: Riccardo Capraro <capraroriccardo@gmail.com>
Key changes include: - Complete API reorganization with cluster/ and namespaced/ separation - Enhanced controller architecture with dual registration - Comprehensive examples and documentation for both scopes - Updated build configuration and CRD generation All changes are backwards compatible Signed-off-by: Riccardo Capraro <capraroriccardo@gmail.com>
…sues - Fix DisposableRequest deletion logic to skip secret injection during deletion - Fix cross-namespace owner reference validation in data-patcher to prevent errors - Add unit tests for DisposableRequest namespaced controller - Update example configuration to remove invalid setOwnerReference for cross-namespace secrets - Add data-patcher tests for cross-namespace scenarios - Fix secret name mismatch in request-with-clusterproviderconfig.yaml example Signed-off-by: Riccardo Capraro <capraroriccardo@gmail.com>
| - application/json | ||
| Authorization: | ||
| - ("Bearer {{ auth:default:token }}") | ||
| - "Bearer {{ auth:default:token }}" |
| details, err := c.http.SendRequest(ctx, mapping.Method, requestDetails.Url, requestDetails.Body, requestDetails.Headers, cr.Spec.ForProvider.InsecureSkipTLSVerify) | ||
|
|
||
| // Skip secret injection during deletion to avoid cross-namespace owner reference issues | ||
| if !meta.WasDeleted(cr) { |
There was a problem hiding this comment.
Does this make sense? This was preventing resources from being deleted
| ref := m.GetProviderConfigReference() | ||
|
|
||
| switch ref.Kind { | ||
| case "ProviderConfig": |
There was a problem hiding this comment.
This is the part that was added to manage multiple provider configs
|
Hey @ricCap! 👋 Thanks for tackling namespaced resources. Before moving forward with this PR, I want to share the direction I'm taking for the codebase architecture. I'm working on a refactor that extracts the business logic into a service layer. Once my refactoring merges you can add namespaced support on top of the shared service layer. This way we maintain the codebase properly while still achieving your namespaced resources goal. The service layer will make your implementation cleaner and reduce the PR size significantly. Let me know if you have questions about the approach! |
|
Closing in favour of #147 |
Description of your changes
This is a first draft of the implementation of namespaced MRs #128 . This PR is a follow up to #139 and includes its changes. You can also have a look at the diff between the two branches here.
This PR includes:
http.m.crossplane.ioThe aim of this PR is to avoid any breaking changes to the existing resources
The changes are based on the following examples:
Warning There are some missing changes (e.g. the hack folder), this PR is still WIP but works and includes everything needed for the migration of the controllers. This PR is not ready to be merged yet.
We should do some refactoring as currently there is a lot of duplication. I would like to agree on how to structure the new repo and what to keep/change first. Since these changes are quite AI-driven, please point out things that don't make sense.
Fixes #128
I have:
make reviewable testto ensure this PR is ready for review.How has this code been tested
Test in ArgoCD
Install using helm and use this application